<?php

namespace app\admin\validate;


use \think\Validate;

/**
 *  地址验证码类
 */
class Address extends Validate
{
    protected $rule = [
        'id' => 'require|number',
        'first_name' => 'require',
        'last_name' => 'require',
        'email' => 'email',
        'phone' => 'require',
        'country_id' => 'require|number',
        'country_name' => 'require',
        'city_id' => 'require|number',
        'city_name' => 'require',
        'state' => 'require',
        'zip_code' => 'require|number',
        'address' => 'require',
        'remark' => 'require'
    ];


    //定义验证提示
    protected $message = [
        'id.require' => 'address.idRequire',
        'id.number' => 'address.idNumber',
        'first_name.require' => 'address.firstNameRequire',
        'last_name.require' => 'address.lastNameRequire',
        'email.email' => 'address.emailEmail',
        'phone.require' => 'address.phoneRequire',
        'country_id.require' => 'address.countryIdRequire',
        'country_id.number' => 'address.countryIdNumber',
        'country_name.require' => 'address.countryNameRequire',
        'city_id.require' => 'address.cityIdRequire',
        'city_id.number' => 'address.cityIdNumber',
        'city_name.require' => 'address.cityNameRequire',
        'state.require' => 'address.stateRequire',
        'zip_code.require' => 'address.zipCodeRequire',
        'zip_code.number' => 'address.zipCodeNumber',
        'address.require' => 'address.addressRequire',
    ];

    //定义验证场景
    protected $scene = [
        'detail' => ['id'],
        'save' => ['first_name','email','phone','country_id','address'],
        'setDefault' => ['id'],
        'del' => ['id'],
    ];


}
